﻿using System;
using System.Collections.Generic;
using System.Text;
using DotNetCore.BannerManagement.Domain;

namespace DotNetCore.BannerManagement.BLL
{
    /// <summary>
    /// Just a temporary manager to get this working
    /// Products will be loaded in the database in a future release
    /// </summary>
    public class ProductManager
    {

        public dnc_Product GetProductByZoneId(int ZoneId)
        {

            IList<dnc_Product> products = GetAllProducts();

            foreach (dnc_Product product in products)
            {
                if (product.ZoneId == ZoneId)
                    return product;
            }

            return new dnc_Product();

        }

        public IList<dnc_Product> GetAllProducts()
        {

            IList<dnc_Product> products = new List<dnc_Product>();

            products.Add(BuildProduct("Top", "This will be located at the top of the forum page", 25, 1));
            products.Add(BuildProduct("Bottom", "This will be located at the bottom of the forum page", 6, 2));

            return products;

        }

        private dnc_Product BuildProduct(string Name, string Description, decimal Cost, int ZoneId)
        {
            dnc_Product product = new dnc_Product();

            product.Name = Name;
            product.Description = Description;
            product.Cost = Cost;
            product.ZoneId = ZoneId;

            return product;

        }


    }
}
